package com.lyq.bean;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateBean {

	private String dateTime;	//日期及时间
	private String week;	//星期
	private Calendar calendar = Calendar.getInstance();	//Calendar对象
	
	/**
	 * 
	* @Title: getDateTime 
	* @Description: TODO(这里用一句话描述这个方法的作用) 获取当前日期和时间
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	public String getDateTime(){
		Date currDate = Calendar.getInstance().getTime();	//获取当前时间
		//实例化SimpleDateFormat
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");	
		dateTime = sdf.format(currDate);	//格式化日期时间
		
		return dateTime;
	}
	
	public String getWeek(){
		//定义数组
		String[] weeks = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
		int index = calendar.get(Calendar.DAY_OF_WEEK);	//获取一星期的某天
		week = weeks[index - 1];
		
		return week;
	}

}
